<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>权限选择</title>
    <ss:head parseContent="true" />
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" href="<%=path %>/css/form.css" type="text/css"></link>
	<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
	<script type="text/javascript">
        $(function(){
            $("#myform").validate();
        });
    </script>
	<style type="text/css">
	        body{margin-right: 50px}
	</style>
  </head>
  <script type="text/javascript">
  	
	function checkBox(obj) {
// 只有当选中的时候才会去掉其他已经勾选的checkbox，所以这里只判断选中的情况
    if (obj.is(":checked")) {
         // 先把所有的checkbox 都设置为不选种
        $('input.mybox').prop('checked', false);
        // 把自己设置为选中
        obj.prop('checked',true);
    }
     setTimeout(function(){
	          
	    var tel = $("#Name"+obj.attr("id")).val();
	           /*  alert(obj.attr("id"));  */
	            /* alert(tel); */
    parent.$("#rightname").val(tel);
    parent.$("#prightid").val(obj.attr("id"));
     var index = parent.layer.getFrameIndex(window.name);//获取窗口索引
	 parent.layer.close(index);//通过索引关闭该窗口 
	        
	        },1000);   
}
  </script>
   
  <body>
  <div class="main">
  	<form action="admin/addSysRole.action" method="post" enctype="multipart/form-data" onsubmit="return checkSR();"id="myform" >	
		<input name="userRegister.roleId" value="3" type="hidden"/>
		<div class="content">
			<table class="box">			
				<tr>
					<td class="field" style="vertical-align: top;">权限名称：</td>
					<td>
						<font color="#FF0000">*必填</font>只能选择一个权限<br>			
						<span id="msgrightId" class="msgRed"></span>
						<table align="center" id="rightTable" width="100%"  border="0" cellpadding="3" cellspacing="1" width="100%" align="center" style="background-color: #b9d8f3;">
							<tr style="text-align: center; COLOR: #0076C8; BACKGROUND-COLOR: #F4FAFF; font-weight: bold">
							<td style="vertical-align: top;">
								<input type="checkbox" class="mybox" onclick="checkBox($(this));" id="0"/>
								一级菜单
							    <input type="hidden" id="Name0"  value="一级菜单">
							</td>
							<td></td>
							</tr>
							<s:iterator value="listSysright"  var="right1">
							<s:if test='#right1.prightid == "0" '>
							<tr style="text-align: center; COLOR: #0076C8; BACKGROUND-COLOR: #F4FAFF; font-weight: bold">
							<td style="vertical-align: top;">
								<input type="checkbox" class="mybox" onclick="checkBox($(this));" id="${rightid}"/>
								${rightname}
							    <input type="hidden" id="Name${rightid}"  value="${rightname}">
							</td>
							<td>
							<table>
							<s:iterator value="listSysright" var="right2">
							<s:if test="#right2.prightid == #right1.rightid">
								<tr><td  style="vertical-align: top;width: 50%">
								    <input type="checkbox" class="mybox" onclick="checkBox($(this));" id="${rightid}"/>
								     ${rightname}
									<input type="hidden" id="Name${rightid}"  value="${rightname}">
									</td>
									
									</tr>
							</s:if>
							</s:iterator>
							</table>
							</td>
							</tr>
							</s:if>
				    		</s:iterator>
			    		</table>
					</td>
				</tr>
				
			
				
				
				
			</table>
		</div>
		
	</form>
</div> 
</body>
</html>
					